<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>DigitalPlat Domain Registry and Management Authority</title>
    
    <!-- Tailwind CSS -->
    <script src="https://cdn.tailwindcss.com"></script>
    
    <!-- Google Fonts -->
    <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap" rel="stylesheet">
    
    <!-- Cloudflare Turnstile -->
    <script src="https://challenges.cloudflare.com/turnstile/v0/api.js?compat=recaptcha" async defer></script>
    
    <style>
        body {
            font-family: 'Poppins', sans-serif;
            background-color: #edf2f7;
            padding: 0;
            margin: 0;
        }
        .container {
            width: 100%;
            max-width: 400px;
            margin: 5% auto;
            padding: 20px;
            background-color: #ffffff;
            border-radius: 12px;
            box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.05);
        }
        .header {
            display: flex;
            align-items: center;
            padding: 10px 20px;
            background-color: #ffffff;
            border-radius: 12px 12px 0 0;
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
            margin-bottom: 20px;
        }
        .logo img {
            width: 80px; /* Adjusted size */
            height: auto;
            border-radius: 50%; /* Circular border */
        }
        .title {
            font-size: 1.2rem;
            font-weight: 600;
            margin-left: 20px;
            color: #1a202c;
        }
        .google-button {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            font-weight: 500;
            background-color: #e2e8f0; /* Subtle background */
            padding: 10px 15px;
            border-radius: 8px;
            transition: background-color 0.3s;
        }
        .google-button:hover {
            background-color: #cbd5e0;
        }
        .footer {
            background-color: #1a202c;
            color: #cbd5e0;
            padding: 20px;
            font-size: 14px;
            border-radius: 0 0 12px 12px;
        }
        footer a {
            color: #63b3ed;
        }
        footer a:hover {
            text-decoration: underline;
        }
    </style>
</head>
<body>
    <div class="header">
        <div class="logo">
            <img src="https://nic.us.kg/wp-content/uploads/2023/05/IMG_20230511_165610.jpg" alt="DigitalPlat Domain Registry and Management Authority">
        </div>
        <div class="title">DigitalPlat Domain Registry and Management Authority</div>
    </div>
    <div class="container mx-auto px-4">
        <form action="/auth/reset-password" method="POST">
            <div class="mb-4">
                <label for="email" class="block text-gray-700 text-sm font-bold mb-2">E-Mail</label>
                <input type="email" name="email" class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" id="email" placeholder="Enter your email" required>
            </div>
            <div class="mb-4">
                <label for="password" class="block text-gray-700 text-sm font-bold mb-2">New Password</label>
                <input type="password" name="new_password" class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" id="new_password" placeholder="Enter your new password" autocomplete="off" required>
                <small id="passwordHelp" class="form-text text-gray-600">The password must be more than 8 characters long and include uppercase and lowercase letters as well as numbers.</small>
            </div>
            <!-- Cloudflare Turnstile -->
            <div class="g-recaptcha mb-4" data-sitekey="{{ sitekey }}"></div>
            <div class="operation flex justify-center mt-4">
                <button type="submit" id="resetButton" class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline" disabled>Reset</button>
            </div>
            <div class="text-center mt-4">
                <small>Don't have an account? <a href="/auth/register" class="text-blue-500">Sign up</a></small>
            </div>
        </form>
    </div>
    <footer class="footer">
        <div class="text-center">
            <small>
                By continuing you agree to our <a href="https://nic.us.kg/terms-of-service/">Terms of Service</a>, <a href="https://nic.us.kg/privacy-policy/">Privacy Policy</a>, and <a href="https://nic.us.kg/acceptable-use-policy/">Acceptable Use Policy</a>.<br>
                If you encounter any problems, please create a new issue: <a href="https://github.com/DigitalPlatDev/US.KG-Issues/issues/new/choose">Issue Report</a><br>
                The 'Sign in with Google' is currently only accessible for accounts registered with Gmail
            </small>
        </div>
    </footer>
    <script>
        document.addEventListener('DOMContentLoaded', function () {
            const passwordInput = document.getElementById('new_password');
            const resetButton = document.getElementById('resetButton');

            passwordInput.addEventListener('input', validatePassword);

            function validatePassword() {
                let isValid = true;

                // Validate Password
                const passwordRequirements = [
                    { regex: /.{8,}/, message: 'at least 8 characters long' },
                    { regex: /[A-Z]/, message: 'an uppercase letter' },
                    { regex: /[a-z]/, message: 'a lowercase letter' },
                    { regex: /\d/, message: 'a number' }
                ];
                const unmetRequirements = passwordRequirements.filter(req => !req.regex.test(passwordInput.value));
                if (unmetRequirements.length === 0) {
                    document.getElementById('passwordHelp').innerHTML = '<span class="text-green-500">Password meets all requirements</span>';
                } else {
                    const messages = unmetRequirements.map(req => req.message).join(', ');
                    document.getElementById('passwordHelp').innerHTML = `<span class="text-red-500">Password must include: ${messages}</span>`;
                    isValid = false;
                }

                if (passwordInput.value.length > 128) {
                    document.getElementById('passwordHelp').innerHTML = '<span class="text-red-500">Password is too long.</span>';
                    isValid = false;
                }

                resetButton.disabled = !isValid;
            }
        });
    </script>
    <script>
        window.va = window.va || function () { (window.vaq = window.vaq || []).push(arguments); };
    </script>
    <script defer src="/_vercel/insights/script.js"></script>
    <script>
        window.si = window.si || function () { (window.siq = window.siq || []).push(arguments); };
    </script>
    <script defer src="/_vercel/speed-insights/script.js"></script>
</body>
</html>
